package com.fyzk.activity.trend;

/**
 * Created by miao on 2017/3/29.
 */

import android.view.View;

import com.fyzk.betzhushu.ssq.SSQ_ZhuShu;

import java.util.List;

/**
 * Created by miao on 2017/2/20.
 */
public class SSQTrendActivity extends TrendBaseActivity {

    @Override
    protected void setSureBtnVisibility() {
        sure_btn.setVisibility(View.VISIBLE);
        zhuShu_ll.setVisibility(View.VISIBLE);
    }

    @Override
    protected TrendBaseView getTrendView() {
        return new SSQTrendView(getContext());
    }

    @Override
    protected String getBetCode(List<TrendBaseView.Drawinfor> infors) {
        String betCode = "";
        String redCode = "";
        String blueCode = "";
        if (infors != null && infors.size() > 0) {
            for (int i = 0; i < infors.size(); i++) {
                if (infors.get(i).isCheck) {
                    if (infors.get(i).type == 0) {
                        redCode += infors.get(i).text+",";
                    } else {
                        blueCode += infors.get(i).text+",";
                    }
                }
            }
        }
        redCode = redCode.substring(0, redCode.length()-1);
        blueCode = blueCode.substring(0, blueCode.length()-1);
        betCode = redCode + "|" + blueCode;
        return betCode;
    }

    @Override
    protected long getZhuShu(List<TrendBaseView.Drawinfor> infors) {
        long zhuShu = 0;
        int redCount = 0;
        int blueCount = 0;
        if (infors != null && infors.size() > 0) {
            for (int i = 0; i < infors.size(); i++) {
                if (infors.get(i).isCheck) {
                    if (infors.get(i).type == 0) {
                        redCount++;
                    } else {
                        blueCount++;
                    }
                }
            }
        }
        zhuShu = new SSQ_ZhuShu().getZhuShu_common(redCount, blueCount);
        return zhuShu;
    }
}
